<?php
/**
 * Created by PhpStorm.
 * User: adamli
 * Date: 15-3-11
 * Time: 上午10:40
 */

class JsjController extends BaseController {

    public function index() {
        $channel = Input::get('channel', 'white');
        $data = array(
            'code' => 1,
            'message' => 'success',
            'data' => array(
                array(
                    'channel'=>'white',
                    'page'=>array(
                        array(
                            'page_title'=>'视频推荐',
                            'page_content' => array(
                                array(
                                    'title'=>'何以笙箫默',
                                    'poscode'=>"01",
                                    'pic'=>"http://172.16.10.137:8080/pic/2014/03/31/11342988922.png",
                                    'content_type'=> 2,
                                    'content_type_text'=>'视频',
                                    'url'=>'xxx'
                                ),
                                array(
                                    'title'=>'最近观看',
                                    'poscode'=>"02",
                                    'pic'=>"http://172.16.10.137:8080/pic/2014/03/31/11342988922.png",
                                    'content_type'=> 2,
                                    'content_type_text'=>'视频',
                                    'url'=>'xxx'
                                ),
                                array(
                                    'title'=>'收藏',
                                    'poscode'=>"03",
                                    'pic'=>"http://172.16.10.137:8080/pic/2014/03/31/11342988922.png",
                                    'content_type'=> 2,
                                    'content_type_text'=>'视频',
                                    'url'=>'xxx'
                                )
                            )
                        ),
                        array(
                            'page_title'=>'影视分类',
                            'page_content' => array(
                                array(
                                    'title'=>'电影',
                                    'poscode'=>"01",
                                    'pic'=>"http://172.16.10.137:8080/pic/2014/03/31/11342988922.png",
                                    'content_type'=> 1,
                                    'content_type_text'=>'分类',
                                    'url'=>'xxx'
                                ),
                                array(
                                    'title'=>'综艺',
                                    'poscode'=>"02",
                                    'pic'=>"http://172.16.10.137:8080/pic/2014/03/31/11342988922.png",
                                    'content_type'=> 1,
                                    'content_type_text'=>'分类',
                                    'url'=>'xxx'
                                ),
                                array(
                                    'title'=>'亲子',
                                    'poscode'=>"03",
                                    'pic'=>"http://172.16.10.137:8080/pic/2014/03/31/11342988922.png",
                                    'content_type'=> 1,
                                    'content_type_text'=>'分类',
                                    'url'=>'xxx'
                                )
                            )
                        )
                    )
                ),

            )
        );
        return Response::json($data, 200);
    }

    public function getDefaultApp() {
        $data = array(
            'code' => 1,
            'message' => 'success',
            'data' => array(
                array(
                    'app_name'=>'PPTVandroid',
                    'app_pkg_name' => 'pptv15.38.apk',
                    'app_down_url' => 'http://www.jpretty.net/pptv15.38.apk',
                ),
                array(
                    'app_name'=>'美图秀秀',
                    'app_pkg_name' => 'meitu15.38.apk',
                    'app_down_url' => 'http://www.jpretty.net/meitu15.38.apk',
                ),
                array(
                    'app_name'=>'支付宝',
                    'app_pkg_name' => 'alipay.38.apk',
                    'app_down_url' => 'http://www.jpretty.net/alipay.38.apk',
                )
            )
        );
        return Response::json($data, 200);
    }

    public function getUnkeys() {
        $channel = Input::get('channel', 'white');
        $data = array(
            'code' => 1,
            'message' => 'success',
            'data' => array(
                array(
                    'keys'=>'up,down,left,right,ok',
                    'channel'=>'white'
                ),
                array(
                    'keys'=>'down,up,left,right,ok',
                    'channel'=>'black'
                ),
                array(
                    'keys'=>'up,down,right,left,ok',
                    'channel'=>'red'
                )
            )
        );
        $temp = array();
        foreach($data['data'] as $v) {
            if($v['channel'] == $channel) {
                $temp = $v;
                break;
            }
        }
        $data['data'] = $temp;
        return Response::json($data, 200);
    }

    //获取关于我们页面信息
    public function getAboutInfo() {
        $channel = Input::get('channel', 'white');
        $data = array(
            'code' => 1,
            'message' => 'success',
            'data' => array(
                array(
                    'phone'=>'13524736684',
                    'website'=>'http://springmvcdemo.jpretty.net',
                    'channel'=>'white'
                ),
                array(
                    'phone'=>'1352478888',
                    'website'=>'http://springmvcdemo.jpretty.net',
                    'channel'=>'black'
                ),
                array(
                    'phone'=>'13527887752',
                    'website'=>'http://springmvcdemo.jpretty.net',
                    'channel'=>'red'
                )
            )
        );
        $temp = array();
        foreach($data['data'] as $v) {
            if($v['channel'] == $channel) {
                $temp = $v;
                break;
            }
        }
        $data['data'] = $temp;
        return Response::json($data, 200);
    }

    //获取默认图
    public function getDefaultPic() {
        $channel = Input::get('channel', 'white');
        $data = array(
            'code' => 1,
            'message' => 'success',
            'data' => array(
                array(
                    'videolist_pic'=>'http://static9.pplive.cn/pub/flagment/v_20140911174634/basic/images/index-list-bg.jpg',
                    'videodetail_pic'=>'http://static9.pplive.cn/pub/flagment/v_20140911174634/basic/images/index-list-bg.jpg',
                    'playerload_pic'=>'http://static9.pplive.cn/pub/flagment/v_20140911174634/basic/images/index-list-bg.jpg',
                    'searchvideo_pic'=>'http://static9.pplive.cn/pub/flagment/v_20140911174634/basic/images/index-list-bg.jpg',
                    'special_pic'=>'http://static9.pplive.cn/pub/flagment/v_20140911174634/basic/images/index-list-bg.jpg',
                    'index_Recommend_pic'=>'http://static9.pplive.cn/pub/flagment/v_20140911174634/basic/images/index-list-bg.jpg',
                    'channel'=>'white'
                ),
                array(
                    'videolist_pic'=>'http://static9.pplive.cn/pub/flagment/v_20140911174634/basic/images/index-list-bg.jpg',
                    'videodetail_pic'=>'http://static9.pplive.cn/pub/flagment/v_20140911174634/basic/images/index-list-bg.jpg',
                    'playerload_pic'=>'http://static9.pplive.cn/pub/flagment/v_20140911174634/basic/images/index-list-bg.jpg',
                    'searchvideo_pic'=>'http://static9.pplive.cn/pub/flagment/v_20140911174634/basic/images/index-list-bg.jpg',
                    'special_pic'=>'http://static9.pplive.cn/pub/flagment/v_20140911174634/basic/images/index-list-bg.jpg',
                    'index_Recommend_pic'=>'http://static9.pplive.cn/pub/flagment/v_20140911174634/basic/images/index-list-bg.jpg',
                    'channel'=>'black'
                ),
                array(
                    'videolist_pic'=>'http://static9.pplive.cn/pub/flagment/v_20140911174634/basic/images/index-list-bg.jpg',
                    'videodetail_pic'=>'http://static9.pplive.cn/pub/flagment/v_20140911174634/basic/images/index-list-bg.jpg',
                    'playerload_pic'=>'http://static9.pplive.cn/pub/flagment/v_20140911174634/basic/images/index-list-bg.jpg',
                    'searchvideo_pic'=>'http://static9.pplive.cn/pub/flagment/v_20140911174634/basic/images/index-list-bg.jpg',
                    'special_pic'=>'http://static9.pplive.cn/pub/flagment/v_20140911174634/basic/images/index-list-bg.jpg',
                    'index_Recommend_pic'=>'http://static9.pplive.cn/pub/flagment/v_20140911174634/basic/images/index-list-bg.jpg',
                    'channel'=>'red'
                )
            )
        );
        $temp = array();
        foreach($data['data'] as $v) {
            if($v['channel'] == $channel) {
                $temp = $v;
                break;
            }
        }
        $data['data'] = $temp;
        return Response::json($data, 200);
    }
}